#include <iostream>
#include <algorithm>

using namespace std;

int p1, p2, p3, n;
string s;
string ret;

//判断是否是数字字符
bool isdig(char ch)
{
	return ch >= '0' && ch <= '9';
}

//判断是否是小写字母
bool islet(char ch)
{
	return ch >= 'a' && ch <= 'z';
}

//把 [left, right] 之间的字符展开
//left 和 right这两个字符是不做处理的
void add(char left, char right)
{
	string t;

	//遍历中间的字符
	for(char ch = left + 1; ch < right; ch++)
	{
		char tmp = ch;
		//处理 p1
		if(p1 == 2 && islet(tmp)) tmp -= 32; // 小写变大写
		else if(p1 == 3) tmp = '*'; // 变成*号

		//处理 p2
		for(int i = 0; i < p2; i++)
		{
			t += tmp;
		}
	}

	//处理p3
	if(p3 == 2) reverse(t.begin(), t.end());

	ret += t;
}

int main()
{
	cin >> p1 >> p2 >> p3 >> s;
	n = s.size();

	for(int i = 0; i < n; i++)
	{
		char ch = s[i];

		if(s[i] != '-' || i == 0 || i == n - 1) ret += ch;
		else // 当前字符是减号 
		{
			char left = s[i - 1], right = s[i + 1];
			//判断是否展开
			if((isdig(left) && isdig(right) && right > left) 
				||(islet(left) && islet(right) && right > left))
			{
				//展开
				add(left, right);
			}
			else 
			{
				//不展开，减号保留
				ret += ch;
			}
		}
	}

	cout << ret << endl;

	return 0;
}





